import { stringify } from 'qs';
import request from '@/utils/request';

export const token = localStorage.getItem('token');
export const user = localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user')) : {};

//物流跟踪平台
export async function queryLogisticsRule(params) {
  return request(`/api/queryLogistics?${stringify(params)}`);
}
export async function queryLogisticsByCode(params) {
  return request(
    '/server/api/track-order/insideSelectOrderInfo',
    {
      method: 'POST',
      body: {
        appKey: 'systemId',
        appSecret: 'DSKN235SD1DE3Y78C',
        messageId: 'MSG18772016',
        orderNos: params.orderNo,
        visitType: 'inside',
      },
    },
    true
  );
}
//获取节点跟踪：
export async function getTracking(params) {
  const { ids,type } = params;
  let url=type?type=='inner'?'insideSelectOrderInfoAdmin':'insideSelectOrderInfo':'externalSelectOrderInfo'
  console.log('???type',type,url)
  return request(
    // `/server/api/api/OCS/Order/GetTracking`, 
   // POST /API/OCS/Order/OrderTracking
    `/server/api/track-order/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
